/**
 *  CompilerHelper.java : IceBird project
 *  15:29:46 
 */
package icebird.compiler.x86.old;

import icebird.metadata.BasicType;

/**
 * @author Sergey Shulepoff[Knott]
 */
public final class CompilerHelper {
	
	static final WordItem requestWordReg(EmitterContext c, BasicType type) {
		ItemFactory fac = c.getItemFactory();
		
		X86Register reg = requestRegister(c, type);
		return fac.createReg(c, type, reg);
	}
	
	static final X86Register requestRegister(EmitterContext c, BasicType type) {
		X86Register reg = c.getGPRPool().request(type);
		
		if (reg == null) {
			c.getVStack().push(c);
			reg = c.getGPRPool().request(type);
		}
		
		return reg;
	}
}
